﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test1
{
    class Program
    {
        static void Main(string[] args)
        {

            GenericList<double> gl = new GenericList<double>();
            Random rd = new Random();
            for(double i = 0; i < 6; i+=0.3)
            {
                gl.add(rd.NextDouble()*5);
            }
            Action<double> printf = n => Console.WriteLine(n);
            GenericList<double>.ForEach(gl, printf);
            Console.WriteLine("---------------------");
            double max = 0;
            GenericList<double>.ForEach(gl, n =>
            {
                if (max < n)
                {
                    max = n;
                }
            });
            Console.WriteLine($"max:{max}");
            Console.WriteLine("---------------------");
            double min = Double.MaxValue;
            GenericList<double>.ForEach(gl, n =>
            {
                if (min > n)
                {
                    min = n;
                }
            });
            Console.WriteLine($"min:{min}");
            Console.WriteLine("---------------------");
            double sum = 0;
            GenericList<double>.ForEach(gl, n =>
            {
                sum += n;
            });
            Console.WriteLine($"sum:{sum}");
            Console.ReadKey();
        }
    }
}
